package cate.game.chat;

import cate.game.role.Role;
import com.fasterxml.jackson.annotation.JsonIgnore;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.ToString;

import java.util.List;

@ToString
@NoteClass(value = "公共频道消息")
public class ChatPublicItem {

    @NoteField(value = "发送者的简单信息")
    public ChatSenderInfo sender;

    @NoteField(value = "频道")
    public byte channel;

    @NoteField(value = "内容ID", detail = "通常由服务器发出的系统消息这种是有contentId的，但是玩家自己发的消息，则只有content")
    public int contentId = 0;

    @NoteField(value = "消息内容", detail = "当contentId=0的时候，直接读取content的内容")
    public String content;

    @NoteField(value = "消息附加参数")
    public List<ChatContentParam> params;

    @NoteField("")
    @JsonIgnore
    public ChatFilter filter;

    public ChatPublicItem() {}

    public ChatPublicItem(Role sender, byte channel, int contentId) {
        this.sender = new ChatSenderInfo(sender);
        this.channel = channel;
        this.contentId = contentId;
    }

    public ChatPublicItem(Role sender, byte channel, String content) {
        this.sender = new ChatSenderInfo(sender);
        this.channel = channel;
        // 因为现在的 屏幕字库表 里包含了[]等一些前端会使用的特殊符号，所以后端就不进行替换了，现在前端自己有替换逻辑
        this.content = content;
    }

    public ChatPublicItem(Role sender, byte channel, int contentId, String content, List<ChatContentParam> params) {
        this.sender = new ChatSenderInfo(sender);
        this.channel = channel;
        this.contentId = contentId;
        this.content = content;
        this.params = params;
    }

    public ChatPublicItem(ChatSenderInfo sender, byte channel, int contentId, String content, List<ChatContentParam> params) {
        this.sender = sender;
        this.channel = channel;
        this.contentId = contentId;
        this.content = content;
        this.params = params;
    }

}
